1. Field of the Invention
The present invention relates to an image processing apparatus, and, more particularly to an image processing apparatus that updates a distribution model and detects a movable body and an immovable body in image data on the basis of the distribution model, an image-data-distribution-model updating apparatus, a processing method in the image processing apparatus and the image-data-distribution-model updating apparatus, and a computer program for causing a computer to execute the method.
2. Description of the Related Art
There are proposed a technique for detecting an object that is added to image data anew and comes to a standstill or an object that disappears from the image data (these objects are hereinafter referred to as immovable bodies) and a technique for detecting or tracking movable bodies that move in image data. As a technique for performing, for example, detection of the movable bodies and the immovable bodies, Gaussian Mixture Modeling (GMM) is known. The Gaussian Mixture Modeling is a technique for mixing and modeling plural Gaussian distributions. In the Gaussian Mixture Modeling, an n-ary distribution model is generated from image data and sequentially updated. It is possible to perform, for example, detection of a movable body and an immovable body by using an average and the weight of the n-ary distribution model (e.g., in a binary distribution model, a “distribution model of k=0” and a “distribution model of k=1”).
In general, a probability P(Xt) of a pixel at time t having luminance Xt is represented by the following formula.
      P    ⁡          (              X        t            )        =            ∑              i        =        1            k        ⁢                  w                  i          ,          t                    ×              η        ⁡                  (                                    X              t                        ,                          μ                              i                ,                t                                      ,                          Σ                              i                ,                t                                              )                    where, k represents the number of normal distributions, wi,t represents the weight of an ith normal distribution at time t, μi,t represents an average of the ith normal distribution at time t, Σi,t represents a covariance of the ith normal distribution at time t, and η represents a probability density function. The probability density function η represents a normal distribution calculated by the following formula.
      η    ⁡          (                        X          t                ,        μ        ,        Σ            )        =            1                                    (                          2              ⁢              π                        )                                n            2                          ⁢                                          Σ                                            1            2                                ⁢          ⅇ                        -                      1            2                          ⁢                              (                                          X                t                            -                              μ                t                                      )                    T                ⁢                              Σ                          -              1                                ⁡                      (                                          X                t                            -                              μ                t                                      )                              A covariance matrix Σk,t is assumed by the following formula.Σk,t=σk2I
In this method employing the Gaussian Mixture Modeling, it is determined to which of k (k is a positive integer) normal distributions the luminances of pixels belong. For example, four luminance normal distributions are prepared and it is determined to which of the four luminance normal distributions the luminances of pixels belong.
For example, it is determined whether the luminance Xt of a certain pixel is within positive and negative ranges of σk with respect to an average μk of a luminance normal distribution thereof. When the luminance Xt is within the range, it is determined that the luminance Xt belongs to the luminance normal distribution. When the luminance Xt is outside the range, it is determined that the luminance Xt does not belong to the luminance normal distribution. When it is determined that the luminance Xt belongs to no luminance normal distribution, the luminance Xt of the pixel at that point is replaced with an average μ of a luminance normal distribution having smallest weight among the k luminance normal distributions.
In this way, for each of the pixels, the weight wk,t of the luminance normal distributions is updated such that the weight of the luminance normal distribution to which the luminance Xt belongs increases and the luminance normal distribution to which the luminance Xt does not belong decreases. For example, the weight wk,t of the luminance normal distribution to which the luminance Xt of the pixel belongs is updated according to the following formula.wk,t=(1−α)wk,t−1+α
On the other hand, for example, the weight wk,t of the luminance normal distribution to which the luminance Xt of the pixel does not belong is updated according to the following formula:wk,t=(1−α)wk,t−1 where, α is updating speed of the weight and is in a range of 0≦α≦1 in the updating formula of the weight Wk,t.
The average μt and the variance σt of the luminance normal distribution are updated according to the following formulas, respectively:μt=(1−ρ)μt−1+ρXt σt2=(1−ρ)σt−12+ρ(Xt−μt)T(Xt−μt)where, ρ is represented by the following formula.ρ=αη(Xt|μk, σk)
The weights of the plural luminance normal distributions are updated until the weight of a distribution equal to or larger than a fixed frame or equal to or larger than a fixed level is obtained. An average of the luminance normal distribution having the largest weight when such weight of the distribution model is obtained indicates the luminance of pixels in a stationary image portion. Therefore, when attention is paid to a change in the average of the luminance normal distribution having the largest weight, it is possible to detect, for each of the pixels, a state of a moving and stopping object while preventing the influence of a movable body as much as possible. This makes it possible to integrate detection results for the respective pixels in terms of positions and detect an immovable body as a group of image portions (see, for example, JP-A-2006-331306) (FIG. 17)).